import requests
# 定义请求的url
url = "https://www.lmonkey.com/"
# 定义请求头信息
headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0'
}
# 发起get请求
res = requests.get(url=url, headers=headers)
# 获取响应状态码
code = res.status_code
print(code)
# 响应成功后把响应的内容写入文件中
if code == 200:
    print(res.text)
    # with open('./test.html', 'w') as fp:
    #     fp.write(res.text)